/*
 * @lc app=leetcode.cn id=762 lang=javascript
 *
 * [762] 二进制表示中质数个计算置位
 */

// @lc code=start
/**
 * @param {number} left
 * @param {number} right
 * @return {number}
 */
var number2 = function (num) {
  let sum = 0;
  while (num) {
    num = num & (num - 1);
    sum++;
  }
  return sum;
}

var countPrimeSetBits = function (left, right) {
  const primes = [2, 3, 5, 7, 11, 13, 17, 19];
  let sum = 0;
  for (let i = left; i <= right; i++) {
    primes.includes(number2(i)) ? sum++ : ''
  }
  return sum;
};
// @lc code=end

